//
//  HOTConfig.m
//  Genpara
//
//  Created by AndyChang.zhang on 14-8-26.
//  Copyright (c) 2014年 zhangchh. All rights reserved.
//

#import "HOTConfig.h"
#import "APService.h"
#import "HOTHttpClient.h"
#import "HOTUserInfo.h"

@interface HOTConfig() {
    
    NSMutableArray *_regionlList;
    NSMutableArray *_certificationList;
    NSMutableArray *_healthList;
    NSMutableArray *_catelList;
    NSMutableArray *_jobTypeList;
}

@end

static HOTConfig *config;
@implementation HOTConfig

@synthesize regionlList = _regionlList,certificationList = _certificationList,healthList = _healthList, catelList = _catelList,jobTypeList = _jobTypeList;

+(instancetype)config {
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        config = [[[self class] alloc] init];
        
        config->_regionlList = [[NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"zenkoku" ofType:@"plist"]] init];
        config->_certificationList = [[NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"certification" ofType:@"plist"]] init];
        config->_healthList = [[NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"health" ofType:@"plist"]] init];
        config->_catelList = [[NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"notes_cate" ofType:@"plist"]] init];
        config->_jobTypeList = [[NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"jobType" ofType:@"plist"]] init];
    });
    
    return config;
}

+(NSString *)registationId {
    
    return [APService registrationID];
}

+(void)registerPullToServer {
    
    HOTHttpClient *httpClient = [HOTHttpClient client];
    HOTUserInfo *userInfo = [HOTUserInfo defaultUser];
    NSDictionary *parameters = @{REQ_KEY_USER_TOKEN : [HOTUtils getString:userInfo.token],
                                 };
    [httpClient requestGETWithURL:HOT_URL_PUSH_SAVE Parameters:parameters success:^(id respoonse) {
        NSLog(@"%@", @"消息id上传成功");
    } failure:^(NSError *error) {
        NSLog(@"消息id上传失败 出错信息 %@", error);
    }];
}


@end
